package org.ccay.async.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;

import org.ccay.core.exception.ApplicationException;

/**
 * 消息配置Bean
 * 	
 * 
 * @since Dec 12, 2011
 */
public class MessageConfig implements InitializingBean {
	
	/** 消息的类型 **/
	private String messageType;
	
	/** 上下文感知 **/
	private boolean contextAware;

	/**
	 * 获取消息的类型
	 * 	
	 * 
	 * @since Dec 12, 2011
	 * @return
	 */
	public String getMessageType() {
		return this.messageType;
	}

	/**
	 * 设置消息的类型
	 * 	
	 * 
	 * @since Dec 12, 2011
	 * @param type
	 */
	public void setMessageType(String type) {
		this.messageType = type;
	}
	
	/**
	 * 设置上下文感知标志
	 * 	
	 * 
	 * @since Feb 20, 2012
	 * @param flag
	 */
	public void setContextAware(boolean flag) {
		this.contextAware = flag;
	}
	
	/**
	 * 是否对上下文敏感
	 * 	
	 * 
	 * @since Feb 20, 2012
	 * @return
	 */
	public boolean isContextAware() {
		return this.contextAware;
	}

	/* (non-Javadoc)
	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
	 */
	public void afterPropertiesSet() throws ApplicationException {
		Assert.notNull(this.messageType);
	}

}
